<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <div v-if="!isLogin">
    <a href="javascript:void(0)">注册</a>
    <a href="javascript:void(0)" @click="isLogin=true">登录</a>
  </div>
  <div v-else>
    <input type="text" placeholder="名字" v-model="newName">
    <a href="javascript:void(0)" @click="arr.push(newName)">添加</a>
    <a href="javascript:void(0)" @click="isLogin=false">登出</a>
  </div>
  <ul>
    <li v-for="name in arr">{{name}}</li>
  </ul>
</div>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.min.js"></script>
<script>
  let v = new Vue({
    el:"body>div",
    data:{
      isLogin:false,
      arr:["关羽","张飞"],
      newName:""
    },
    // methods:{
    //   f(){
    //     v.arr.push(v.newName)
    //   }
    // }
  })
</script>
</body>
</html>